package com.gcd.skymallorderitemapi.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.situ.model.OrderItem;
import org.apache.ibatis.annotations.Mapper;


@Mapper
public interface OrderItemMapper extends BaseMapper<OrderItem> {
    //查询所有
    default Page<OrderItem> findAll(Page<OrderItem> page, OrderItem orderItem) {
        LambdaQueryWrapper<OrderItem> queryWrapper = Wrappers.lambdaQuery(orderItem);
        return selectPage(page, queryWrapper);
    }

    //根据订单id查询
    default Page<OrderItem> findByOrderId(Page<OrderItem> page, Integer orderId) {
        LambdaQueryWrapper<OrderItem> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(OrderItem::getOrderId, orderId);
        return selectPage(page, queryWrapper);
    }
}
